package Servlet.MainPage;

import BaseClass.PetInfo;
import DataBase.DataBase;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

public class GetPetAllInfoServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<PetInfo> petInfo = DataBase.getAllPetInfo();
        HttpSession HS = req.getSession();
        HS.setAttribute("AllPetInfo",petInfo);
//        req.getRequestDispatcher("Pet.jsp").forward(req,resp);
//        HS.setAttribute();
        resp.sendRedirect("PetInfo/Pet.jsp");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }

}
